#include "defaultscreen.h"
#include "ui_defaultscreen.h"

DefaultScreen::DefaultScreen(Fenetre* f, QWidget *parent) :
    QWidget(parent),
    ui(new Ui::DefaultScreen),
    fen(f)
{
    ui->setupUi(this);

    QObject::connect(ui->bJoin, SIGNAL(clicked()), fen, SLOT(joinGame()));
}

DefaultScreen::~DefaultScreen()
{
    delete ui;
}

void DefaultScreen::addPartie(QString q)
{
    this->ui->listeServers->addItem(q);
}

void DefaultScreen::clearPartie()
{
    this->ui->listeServers->clear();
}

bool DefaultScreen::isServerSelected()
{
    if (ui->listeServers->currentItem() != NULL)
    {
        return true;
    }
    else
    {
        return false;
    }
}

int DefaultScreen::getCurrentRow()
{
    return ui->listeServers->currentRow();
}
